package com.tensquare.article.dao;

import com.tensquare.article.pojo.Article;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface ArticleDao extends JpaRepository<Article,String>,JpaSpecificationExecutor<Article> {

    //文章审核
    @Query(nativeQuery = true,value = "update tb_article set state='1' where id=?1 ")
    @Modifying    //执行jpa的增、删、改操作时必须添加这个注解
    public void updateStatus(String articleId);
    //文章点赞
    @Query(nativeQuery = true,value = "update tb_article set thumbup=thumbup+1 where id=?1")
    @Modifying    //执行jpa的增、删、改操作时必须添加这个注解
    public void updateThumpup(String articleId);
    //

}
